<!-- 
	Tollbar com o comportamento padrão de um CRUD
 -->

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:cc="http://java.sun.com/jsf/composite"
	xmlns:p="http://primefaces.prime.com.tr/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">

<cc:interface>
	<cc:attribute name="managedbean" required="true"></cc:attribute>
	<cc:attribute name="widgetVar" required="true"></cc:attribute>
</cc:interface>
<cc:implementation>

	<p:tooltip global="true" />
	<p:toolbar id="toolbar" styleClass="ui-widget-toolbar ">
		<p:toolbarGroup align="left">
		
			<p:commandButton 
			     type="push" 
			     value="Novo"
				 image="ui-icon-document"
				 actionListener="#{cc.attrs.managedbean.novo}"
				 rendered="#{!cc.attrs.managedbean.estadoCadastrando and !cc.attrs.managedbean.estadoEditando}"
				 update="frmPrincipal" />
			
			<p:commandButton 
				 type="push"
				 value="Buscar"
				 onclick="dlg.show()"
				 image="ui-icon-search"
				 rendered="#{!cc.attrs.managedbean.estadoCadastrando and !cc.attrs.managedbean.estadoEditando}"
				 update="modal" />
			 
			<p:commandButton 
			    type="push" 
			    value="Salvar" 
			    image="ui-icon-disk"
				actionListener="#{cc.attrs.managedbean.salvar}"
				rendered="#{cc.attrs.managedbean.estadoCadastrando || cc.attrs.managedbean.estadoEditando}"
				update="frmPrincipal" />
				
			<p:commandButton 
			    type="push" 
			    value="Cancelar"
				actionListener="#{cc.attrs.managedbean.cancelar}"
				image="ui-icon-circle-close"
				rendered="#{cc.attrs.managedbean.estadoCadastrando || cc.attrs.managedbean.estadoEditando  || cc.attrs.managedbean.estadoEditando}"
				update="frmPrincipal" />
			
			<p:commandButton 
				type="push" 
				value="Editar" 
				image="ui-icon-pencil"
				actionListener="#{cc.attrs.managedbean.editar}"
				rendered="#{cc.attrs.managedbean.estadoSelecionado and !cc.attrs.managedbean.estadoEditando}"
				update="frmPrincipal" />
			
			<p:commandButton 
				type="push" 
				value="Exluir"
				actionListener="#{cc.attrs.managedbean.excluir}"
				rendered="#{cc.attrs.managedbean.estadoSelecionado and !cc.attrs.managedbean.estadoEditando}"
				image="ui-icon-trash"
				update="frmPrincipal" />
			
			<p:commandButton 
				type="push"
				value="Atualizar" 
				image="ui-icon-arrowrefresh-1-s"
				actionListener="#{cc.attrs.managedbean.iniciarAtualizar}"
				rendered="#{cc.attrs.managedbean.estadoSelecionado and !cc.attrs.managedbean.estadoEditando}"
				update="frmPrincipal" />
				 
		</p:toolbarGroup>
	</p:toolbar>

</cc:implementation>
</html>